use rocket::{ get};
use rocket::serde::{Deserialize};
use rocket::serde::json::{serde_json::json, Value};

use crate::domain::goods::Goods;
use crate::RB;
use crate::response::response_object::RespData;


#[get("/wxUser/get_goods_info")]
pub async fn get_goods_info() ->Value{
    let res = Goods::get_all_goods_info(&mut RB.clone()).await;
    return match res {
        Ok(res) => {
            json!(res)
        }
        Err(_) => {
            json!(RespData::<()>::error())
        }
    }

}

